package com.han.swagger2markdown.core.document;

import com.han.swagger2markdown.core.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Api("文档相关接口")
@RestController
@RequestMapping("/documents")
public class DocumentController {

    @ApiOperation("创建文档")
    @PostMapping()
    public Result<Document> create(@RequestBody DocumentCreateParam createParam) {
        return Result.success(new Document());
    }

    @ApiOperation("批量创建文档")
    @PostMapping("/batch")
    public Result<List<Document>> batchCreate(@RequestBody List<DocumentCreateParam> createParams) {
        return Result.success(new ArrayList<>());
    }

    @ApiOperation("查询文档列表")
    @GetMapping("/list")
    public Result<List<Document>> list(@ApiParam("模糊查询") @RequestParam(required = false) String name) {
        return Result.success(new ArrayList<>());
    }

    @ApiOperation("查询文档 by id")
    @GetMapping("/{id}")
    public Result<Document> queryByOid(@PathVariable Integer id) {
        return Result.success(new Document());
    }

    @ApiOperation("更新文档 by id")
    @PutMapping("/{id}")
    public Result<Document> updateByOid(@PathVariable Integer id, @RequestBody DocumentUpdateParam updateParam) {
        return Result.success(new Document());
    }

    @ApiOperation("删除文档")
    @DeleteMapping("/{id}")
    public Result<Void> deleteByOid(@PathVariable Integer id) {
        return Result.success();
    }

    @ApiOperation("批量删除文档")
    @DeleteMapping("/batch")
    public Result<Void> batchDeleteByOids(@RequestBody List<String> oids) {
        return Result.success();
    }
}
